<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <include file="Public:header" />
</head>
<body>
  <include file="Public:body_top" />

  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-3 col-md-2 sidebar hidden-xs">
        <div class="menu">
          <dl>
            <dt><i class="cm-order"></i>商家统计</dt>
            <dd><a href="{:U('Statistics/index')}">商品销量统计</a></dd>
            <dd><a href="{:U('Statistics/sales_count')}">店铺销量统计</a></dd>
            <dd class="active"><a href="{:U('Statistics/withdraw_count')}">店铺提现统计</a></dd>
          </dl>
        </div>
      </div>
      <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="main-hd">
          <h5>订单列表</h5>
        </div>
        <div class="main-bd"> 
          <form method="post" action="{:U('Statistics/withdraw_count')}" id="myfrom">
            <div class="form-box order-datatime">
              <div class="form-horizontal">
                <div class="form-group">
                  <label class="col-sm-2 control-label">下单时间</label>
                  <div class="col-sm-3 form_datetime">
                    <input class="form-control" id="datetime-start" type="text" placeholder="开始时间" name="beg_time" value="{$beg_time}" id="beg_time" readonly>
                    <!-- <span class="input-group-addon"><i class="cm-calendar"></i></span> -->
                  </div>
                  <label class="col-sm-1 control-label">到</label>
                  <div class="col-sm-3">
                    <input class="form-control" id="datetime-end" type="text" placeholder="结束时间" name="end_time" value="{$end_time}" id="end_time" readonly>
                    <!-- <span class="input-group-addon"><i class="cm-calendar"></i></span> -->
                  </div>
                </div>

                <div class="form-group">
                  <label class="col-sm-2 control-label">店铺名称</label>
                  <div class="col-sm-3">
                    <input class="form-control" name="shop_name" type="text" placeholder="输入店铺名称" value="{$shop_name}">
                  </div>
                </div>
                <div class="form-group">
                  <div class="col-sm-12 col-md-9 form-box-btns">
                    <input id="flag" type="hidden" name="flag" value="">
                    <input id="status" type="hidden" name="status" value="<?= $_GET['status']; ?>" >
                    <a class="btn btn-primary" href="#" onClick="inquiry()">查询</a>
                    <a class="btn btn-default" href="#" onClick="flag()">导出</a>
                  </div>
                </div>
              </div>
            </div>
          </form>
          <div class="tab-content">
            <div class="tab-pane active" id="all-order">
              <div class="table-responsive">
                <table class="table table-cmcm">
                  <tr>
                    <th>商铺ID</th>
                    <th>商户</th>
                    <th>累计提现</th>
                    <th>可提现</th>
                    <th>可返利</th>
                    <th>平台利润</th>
                    <th>店铺状态</th>
                    <th>创建时间</th>
                  </tr>
                  <volist name="page_list.list" id="vo">
                    <tr>
                      <td>{$vo.id}</td>
                      <td>{$vo.shop_name}</td>
                      <td>{$vo.total_amount}</td>
                      <td>{$vo.amount}</td>
                      <td>{$vo.brokerage}</td>
                      <td><?= $vo['total_amount'] - $vo['amount_num'] ?></td>
                      <td><if condition="$vo.status eq 1">开启<else />关闭</if></td>
                      <td><?= date("Y-m-d H:i:s", $vo['created_at']); ?></td>
                    </tr>
                  </volist>
                </table>
              </div>

              <ul class="pagination pull-right">
                <li>
                  <a href="{$page_list.page.first.href}" aria-label="Previous">
                      <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                <li>
                  <a href="{$page_list.page.front.href}" aria-label="Previous">
                      <span aria-hidden="true">&lt;</span>
                    </a>
                </li>
                <volist name="page_list.page.list" id="plist">
                  <li <eq name="plist.index" value="1">class="active"</eq>><a href="{$plist.href}">{$plist.page}</a></li>
                </volist>
                <li>
                  <a href="{$page_list.page.after.href}" aria-label="Next">
                      <span aria-hidden="true">&gt;</span>
                    </a>
                </li>
                <li>
                  <a href="{$page_list.page.last.href}" aria-label="Next">
                      <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

    <script>
      function inquiry(){
         document.getElementById("flag").value='';
          $('#myfrom').submit();
      }
      function flag(){
         document.getElementById("flag").value='true';
         $('#myfrom').submit();
      }

      //datetimepicker
      $('#datetime-start').datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        autoclose: true,
        todayBtn: true,
        language: 'zh-CN'
      });
      $('#datetime-end').datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        autoclose: true,
        todayBtn: true,
        language: 'zh-CN'
      });
      $("#datetime-start").on("dp.change", function(e) {
        $('#datetime-end').data("DateTimePicker").minDate(e.date);
      });
      $("#datetime-end").on("dp.change", function(e) {
        $('#datetime-start').data("DateTimePicker").maxDate(e.date);
      });
    </script>
</body>

</html>